package com.zhaoshixin.es.utils;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 作者:赵士欣
 * 日期:2022/8/2
 **/
public class ThreadTest {
    public static void main(String[] args) {
        /*new SendMsg().start();
        new Thread(new SendMail()).start();*/
        /*Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("-----------------");
            }
        };
        new Thread(runnable).start();
    }*/
//        new Thread(()->{System.out.println("这是使用lambda的方式创建线程");}).start();
        //创建固定数量线程池
        ExecutorService executorService = Executors.newFixedThreadPool(2);
        executorService.submit(()->{System.out.println("线程池的方式执行");});
        System.out.println("hh");
        //哈哈哈
    }
}
